<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<link rel="STYLESHEET" href="lib.css" type='text/css' />
<link rel="SHORTCUT ICON" href="../icons/pyfav.png" type="image/png" />
<link rel='start' href='../index.html' title='Python documentation Index' />
<link rel="first" href="lib.html" title='Python library Reference' />
<link rel='contents' href='contents.html' title="Contents" />
<link rel='index' href='genindex.html' title='Index' />
<link rel='last' href='about.html' title='About this document...' />
<link rel='help' href='about.html' title='About this document...' />
<link rel="prev" href="mailbox-babylmessage.html" />
<link rel="parent" href="mailbox-message-objects.html" />
<link rel="next" href="node176.html" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name='aesop' content='information' />
<title>7.3.2.5 MMDFMessage</title>
</head>
<body>
<div class="navigation">
<div id='top-navigation-panel' xml:id='top-navigation-panel'>
<table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td class='online-navigation'><a rel="prev" title="7.3.2.4 BabylMessage"
  href="mailbox-babylmessage.html"><img src='../icons/previous.png'
  border='0' height='32'  alt='Previous Page' width='32' /></a></td>
<td class='online-navigation'><a rel="parent" title="7.3.2 message objects"
  href="mailbox-message-objects.html"><img src='../icons/up.png'
  border='0' height='32'  alt='Up one Level' width='32' /></a></td>
<td class='online-navigation'><a rel="next" title="7.3.3 Exceptions"
  href="node176.html"><img src='../icons/next.png'
  border='0' height='32'  alt='Next Page' width='32' /></a></td>
<td align="center" width="100%">Python Library Reference</td>
<td class='online-navigation'><a rel="contents" title="Table of Contents"
  href="contents.html"><img src='../icons/contents.png'
  border='0' height='32'  alt='Contents' width='32' /></a></td>
<td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png'
  border='0' height='32'  alt='Module Index' width='32' /></a></td>
<td class='online-navigation'><a rel="index" title="Index"
  href="genindex.html"><img src='../icons/index.png'
  border='0' height='32'  alt='Index' width='32' /></a></td>
</tr></table>
<div class='online-navigation'>
<b class="navlabel">Previous:</b>
<a class="sectref" rel="prev" href="mailbox-babylmessage.html">7.3.2.4 BabylMessage</a>
<b class="navlabel">Up:</b>
<a class="sectref" rel="parent" href="mailbox-message-objects.html">7.3.2 Message objects</a>
<b class="navlabel">Next:</b>
<a class="sectref" rel="next" href="node176.html">7.3.3 Exceptions</a>
</div>
<hr /></div>
</div>
<!--End of Navigation Panel-->

<h3><a name="SECTION009325000000000000000"></a>
<a name="mailbox-mmdfmessage"></a>
<br>
7.3.2.5 <tt class="class">MMDFMessage</tt>
</h3>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><span class="typelabel">class</span>&nbsp;<tt id='l2h-1440' xml:id='l2h-1440' class="class">MMDFMessage</tt></b>(</nobr></td>
  <td><var></var><big>[</big><var>message</var><big>]</big><var></var>)</td></tr></table></dt>
<dd>
A message with MMDF-specific behaviors. Parameter <var>message</var> has the same
meaning as with the <tt class="class">Message</tt> constructor.
</dl>

<p>
As with message in an mbox mailbox, MMDF messages are stored with the sender's
address and the delivery date in an initial line beginning with "From ".
Likewise, flags that indicate the state of the message are typically stored in
<span class="mailheader">Status:</span> and <span class="mailheader">X-Status:</span> headers.

<p>
Conventional flags for MMDF messages are identical to those of mbox message and
are as follows:

<p>
<div class="center"><table class="realtable">
  <thead>
    <tr>
      <th class="left"  >Flag</th>
      <th class="left"  >Meaning</th>
      <th class="left"  >Explanation</th>
      </tr>
    </thead>
  <tbody>
    <tr><td class="left"   valign="baseline">R</td>
        <td class="left"  >Read</td>
        <td class="left"  >Read</td></tr>
    <tr><td class="left"   valign="baseline">O</td>
        <td class="left"  >Old</td>
        <td class="left"  >Previously detected by MUA</td></tr>
    <tr><td class="left"   valign="baseline">D</td>
        <td class="left"  >Deleted</td>
        <td class="left"  >Marked for subsequent deletion</td></tr>
    <tr><td class="left"   valign="baseline">F</td>
        <td class="left"  >Flagged</td>
        <td class="left"  >Marked as important</td></tr>
    <tr><td class="left"   valign="baseline">A</td>
        <td class="left"  >Answered</td>
        <td class="left"  >Replied to</td></tr></tbody>
</table></div>

<p>
The "R" and "O" flags are stored in the <span class="mailheader">Status:</span> header, and the
"D", "F", and "A" flags are stored in the <span class="mailheader">X-Status:</span> header. The
flags and headers typically appear in the order mentioned.

<p>
<tt class="class">MMDFMessage</tt> instances offer the following methods, which are identical
to those offered by <tt class="class">mboxMessage</tt>:

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-1441' xml:id='l2h-1441' class="method">get_from</tt></b>(</nobr></td>
  <td><var></var>)</td></tr></table></dt>
<dd>
Return a string representing the "From&nbsp;" line that marks the start of the
message in an mbox mailbox. The leading "From&nbsp;" and the trailing newline are
excluded.
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-1442' xml:id='l2h-1442' class="method">set_from</tt></b>(</nobr></td>
  <td><var>from_</var><big>[</big><var>, time_=None</var><big>]</big><var></var>)</td></tr></table></dt>
<dd>
Set the "From&nbsp;" line to <var>from_</var>, which should be specified without a
leading "From&nbsp;" or trailing newline. For convenience, <var>time_</var> may be
specified and will be formatted appropriately and appended to <var>from_</var>. If
<var>time_</var> is specified, it should be a <tt class="class">struct_time</tt> instance, a tuple
suitable for passing to <tt class="method">time.strftime()</tt>, or <code>True</code> (to use
<tt class="method">time.gmtime()</tt>).
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-1443' xml:id='l2h-1443' class="method">get_flags</tt></b>(</nobr></td>
  <td><var></var>)</td></tr></table></dt>
<dd>
Return a string specifying the flags that are currently set. If the message
complies with the conventional format, the result is the concatenation in the
following order of zero or one occurrence of each of "<tt class="character">R</tt>",
"<tt class="character">O</tt>", "<tt class="character">D</tt>", "<tt class="character">F</tt>", and "<tt class="character">A</tt>".
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-1444' xml:id='l2h-1444' class="method">set_flags</tt></b>(</nobr></td>
  <td><var>flags</var>)</td></tr></table></dt>
<dd>
Set the flags specified by <var>flags</var> and unset all others. Parameter
<var>flags</var> should be the concatenation in any order of zero or more
occurrences of each of "<tt class="character">R</tt>", "<tt class="character">O</tt>", "<tt class="character">D</tt>",
"<tt class="character">F</tt>", and "<tt class="character">A</tt>".
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-1445' xml:id='l2h-1445' class="method">add_flag</tt></b>(</nobr></td>
  <td><var>flag</var>)</td></tr></table></dt>
<dd>
Set the flag(s) specified by <var>flag</var> without changing other flags. To add
more than one flag at a time, <var>flag</var> may be a string of more than one
character.
</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-1446' xml:id='l2h-1446' class="method">remove_flag</tt></b>(</nobr></td>
  <td><var>flag</var>)</td></tr></table></dt>
<dd>
Unset the flag(s) specified by <var>flag</var> without changing other flags. To
remove more than one flag at a time, <var>flag</var> maybe a string of more than one
character.
</dl>

<p>
When an <tt class="class">MMDFMessage</tt> instance is created based upon a
<tt class="class">MaildirMessage</tt> instance, a "From&nbsp;" line is generated based upon the
<tt class="class">MaildirMessage</tt> instance's delivery date, and the following conversions
take place:

<p>
<div class="center"><table class="realtable">
  <thead>
    <tr>
      <th class="left"  >Resulting state</th>
      <th class="left"  ><tt class="class">MaildirMessage</tt> state</th>
      </tr>
    </thead>
  <tbody>
    <tr><td class="left"   valign="baseline">R flag</td>
        <td class="left"  >S flag</td></tr>
    <tr><td class="left"   valign="baseline">O flag</td>
        <td class="left"  >"cur" subdirectory</td></tr>
    <tr><td class="left"   valign="baseline">D flag</td>
        <td class="left"  >T flag</td></tr>
    <tr><td class="left"   valign="baseline">F flag</td>
        <td class="left"  >F flag</td></tr>
    <tr><td class="left"   valign="baseline">A flag</td>
        <td class="left"  >R flag</td></tr></tbody>
</table></div>

<p>
When an <tt class="class">MMDFMessage</tt> instance is created based upon an <tt class="class">MHMessage</tt>
instance, the following conversions take place:

<p>
<div class="center"><table class="realtable">
  <thead>
    <tr>
      <th class="left"  >Resulting state</th>
      <th class="left"  ><tt class="class">MHMessage</tt> state</th>
      </tr>
    </thead>
  <tbody>
    <tr><td class="left"   valign="baseline">R flag and O flag</td>
        <td class="left"  >no "unseen" sequence</td></tr>
    <tr><td class="left"   valign="baseline">O flag</td>
        <td class="left"  >"unseen" sequence</td></tr>
    <tr><td class="left"   valign="baseline">F flag</td>
        <td class="left"  >"flagged" sequence</td></tr>
    <tr><td class="left"   valign="baseline">A flag</td>
        <td class="left"  >"replied" sequence</td></tr></tbody>
</table></div>

<p>
When an <tt class="class">MMDFMessage</tt> instance is created based upon a
<tt class="class">BabylMessage</tt> instance, the following conversions take place:

<p>
<div class="center"><table class="realtable">
  <thead>
    <tr>
      <th class="left"  >Resulting state</th>
      <th class="left"  ><tt class="class">BabylMessage</tt> state</th>
      </tr>
    </thead>
  <tbody>
    <tr><td class="left"   valign="baseline">R flag and O flag</td>
        <td class="left"  >no "unseen" label</td></tr>
    <tr><td class="left"   valign="baseline">O flag</td>
        <td class="left"  >"unseen" label</td></tr>
    <tr><td class="left"   valign="baseline">D flag</td>
        <td class="left"  >"deleted" label</td></tr>
    <tr><td class="left"   valign="baseline">A flag</td>
        <td class="left"  >"answered" label</td></tr></tbody>
</table></div>

<p>
When an <tt class="class">MMDFMessage</tt> instance is created based upon an
<tt class="class">mboxMessage</tt> instance, the "From&nbsp;" line is copied and all flags directly
correspond:

<p>
<div class="center"><table class="realtable">
  <thead>
    <tr>
      <th class="left"  >Resulting state</th>
      <th class="left"  ><tt class="class">mboxMessage</tt> state</th>
      </tr>
    </thead>
  <tbody>
    <tr><td class="left"   valign="baseline">R flag</td>
        <td class="left"  >R flag</td></tr>
    <tr><td class="left"   valign="baseline">O flag</td>
        <td class="left"  >O flag</td></tr>
    <tr><td class="left"   valign="baseline">D flag</td>
        <td class="left"  >D flag</td></tr>
    <tr><td class="left"   valign="baseline">F flag</td>
        <td class="left"  >F flag</td></tr>
    <tr><td class="left"   valign="baseline">A flag</td>
        <td class="left"  >A flag</td></tr></tbody>
</table></div>

<p>

<div class="navigation">
<div class='online-navigation'>
<p></p><hr />
<table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td class='online-navigation'><a rel="prev" title="7.3.2.4 BabylMessage"
  href="mailbox-babylmessage.html"><img src='../icons/previous.png'
  border='0' height='32'  alt='Previous Page' width='32' /></a></td>
<td class='online-navigation'><a rel="parent" title="7.3.2 message objects"
  href="mailbox-message-objects.html"><img src='../icons/up.png'
  border='0' height='32'  alt='Up one Level' width='32' /></a></td>
<td class='online-navigation'><a rel="next" title="7.3.3 Exceptions"
  href="node176.html"><img src='../icons/next.png'
  border='0' height='32'  alt='Next Page' width='32' /></a></td>
<td align="center" width="100%">Python Library Reference</td>
<td class='online-navigation'><a rel="contents" title="Table of Contents"
  href="contents.html"><img src='../icons/contents.png'
  border='0' height='32'  alt='Contents' width='32' /></a></td>
<td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png'
  border='0' height='32'  alt='Module Index' width='32' /></a></td>
<td class='online-navigation'><a rel="index" title="Index"
  href="genindex.html"><img src='../icons/index.png'
  border='0' height='32'  alt='Index' width='32' /></a></td>
</tr></table>
<div class='online-navigation'>
<b class="navlabel">Previous:</b>
<a class="sectref" rel="prev" href="mailbox-babylmessage.html">7.3.2.4 BabylMessage</a>
<b class="navlabel">Up:</b>
<a class="sectref" rel="parent" href="mailbox-message-objects.html">7.3.2 Message objects</a>
<b class="navlabel">Next:</b>
<a class="sectref" rel="next" href="node176.html">7.3.3 Exceptions</a>
</div>
</div>
<hr />
<span class="release-info">Release 2.5.1, documentation updated on 18th April, 2007.</span>
</div>
<!--End of Navigation Panel-->
<address>
See <i><a href="about.html">About this document...</a></i> for information on suggesting changes.
</address>
</body>
</html>
